package ee.ut.sysmodel.bgmn;

import java.util.List;

import ee.ut.sysmodel.bgmn.model.BackgammonException;
import ee.ut.sysmodel.bgmn.model.BoardState;
import ee.ut.sysmodel.bgmn.model.DiceResult;
import ee.ut.sysmodel.bgmn.model.Move;
import ee.ut.sysmodel.bgmn.model.Player;
import ee.ut.sysmodel.bgmn.model.Session;

public class ModelTest { // Ignore me, I'll test interaction between model classes later
	public static void main(String[] args) throws BackgammonException {
		Player p1 = new Player(Player.Identity.PLAYER_ONE);
		Player p2 = new Player(Player.Identity.PLAYER_TWO);
		
		BoardState board = new BoardState(p1, p2);
		
		board.getPin(1).setState(p1, 2);
		board.getPin(3).setState(p2, 2);
		board.getPin(5).setState(p2, 2);
		board.getPin(7).setState(p2, 1);
		
		DiceResult dr1 = new DiceResult(2);
		DiceResult dr5 = new DiceResult(2);
		Session session = new Session(p1, p2, board, new DiceResult[] { dr1, dr5 });
		
		//dr1.setUsed(true);
		//p1.setBarCount(1);
		List<Move> moves = session.getAvailableMoves(1);
		System.out.println(moves);
		
		
		/*for(Move mv : moves) {
			int distance = 0;
			for(DiceResult dr : mv.getUsedDice()) {
				distance += dr.getResult();
			}
			
			if(distance == 5) {
				session.makeMove(mv);
				break;
			}
		}
		
		System.out.println(session.getAvailableMoves(1));
		System.out.println(board.getPin(6).getPieceCount());*/
	}
}
